SQL Server Management Studio (SSMS) is an integrated environment for managing any SQL infrastructure. Use SSMS to access, configure, manage, administer, and develop all components of SQL Server, Azure SQL Database, and SQL Data Warehouse. SSMS provides a single comprehensive utility that combines a broad group of graphical tools with a number of rich script editors to provide access to SQL Server for developers and database administrators of all skill levels.
To access, configure, manage, and administer Analysis Services, Integration Services, and Reporting Services, use SQL Server Management Studio. Although all three business intelligence technologies rely on SQL Server Management Studio, the administrative tasks associated with each of these technologies are slightly different.
Right-click your server instance in Object Explorer, and then select New Query:
      
Into the query window, paste the following T-SQL code snippet: SQL USE master GO IF NOT EXISTS ( SELECT name FROM sys.databases WHERE name = N'TutorialDB' ) CREATE DATABASE [TutorialDB] GO To execute the query, select Execute (or select F5 on your keyboard).
      
After the query is complete, the new TutorialDB database appears in the list of databases in Object Explorer. If it isn't displayed, right-click the Databases node, and then select Refresh.
Paste the following T-SQL code snippet into the query window, select it, and then select Execute (or select F5 on your keyboard).
      
SQL -- Create a new table called 'Customers' in schema 'dbo' -- Drop the table if it already exists IF OBJECT_ID('dbo.Customers', 'U') IS NOT NULL DROP TABLE dbo.Customers GO -- Create the table in the specified schema CREATE TABLE dbo.Customers ( CustomerId INT NOT NULL PRIMARY KEY, -- primary key column Name [NVARCHAR](50) NOT NULL, Location [NVARCHAR](50) NOT NULL, Email [NVARCHAR](50) NOT NULL ); GO
Insert some rows into the Customers table that you created previously. To do so, paste the following T-SQL code snippet into the query window, and then select Execute:
      
SQL -- Insert rows into table 'Customers' INSERT INTO dbo.Customers ([CustomerId],[Name],[Location],[Email]) VALUES ( 1, N'Orlando', N'Australia', N''), ( 2, N'Keith', N'India', N'keith0@adventure-works.com'), ( 3, N'Donna', N'Germany', N'donna0@adventure-works.com'), ( 4, N'Janet', N'United States', N'janet1@adventure-works.com') GO
The results of a query are visible below the query text window. To query the Customers table and view the rows that were previously inserted, follow these steps:
      
Paste the following T-SQL code snippet into the query window, and then select Execute: SQL -- Select rows from table 'Customers' SELECT * FROM dbo.Customers;
Update Query is Below
      
update Customers set Name='raj' where CustomerId=1
you can delete records using following commands
      
delete from Customers where CustomerId=1
The ORDER BY keyword is used to sort the result-set in ascending or descending order. The ORDER BY keyword sorts the records in ascending order by default. To sort the records in descending order, use the DESC keyword.
      
SELECT * FROM Customers ORDER BY Location
The SELECT DISTINCT statement is used to return only distinct (different) values. Inside a table, a column often contains many duplicate values; and sometimes you only want to list the different (distinct) values.
      
SELECT distinct Location FROM Customers;
A field with a NULL value is a field with no value. If a field in a table is optional, it is possible to insert a new record or update a record without adding a value to this field. Then, the field will be saved with a NULL value.
      
SELECT * FROM Customers where Location is null
The SELECT TOP clause is used to specify the number of records to return. The SELECT TOP clause is useful on large tables with thousands of records. Returning a large number of records can impact performance.
      
SELECT top 10 * FROM Customers
The MIN() function returns the smallest value of the selected column.
      
SELECT MIN(Price) AS SmallestPrice FROM Products;
The MAX() function returns the largest value of the selected column.
      
SELECT MAX(Price) AS LargestPrice FROM Products;
The COUNT() function returns the number of rows that matches a specified criteria.
      
SELECT count(*) as TotalRecords FROM Customers
The AVG() function returns the average value of a numeric column.
      
SELECT AVG(Price) FROM Products;
The SUM() function returns the total sum of a numeric column.
      
SELECT SUM(Quantity) FROM OrderDetails;
The LIKE operator is used in a WHERE clause to search for a specified pattern in a column. There are two wildcards often used in conjunction with the LIKE operator: % - The percent sign represents zero, one, or multiple characters _ - The underscore represents a single character
      
SELECT * FROM Customers wher Location like '%tamilnadu%'
A JOIN clause is used to combine rows from two or more tables, based on a related column between them.
The INNER JOIN keyword selects records that have matching values in both tables.
      
SELECT column_name(s) FROM table1 INNER JOIN table2 ON table1.column_name = table2.column_name;
The LEFT JOIN keyword returns all records from the left table (table1), and the matched records from the right table (table2). The result is NULL from the right side, if there is no match.
      
SELECT column_name(s) FROM table1 LEFT JOIN table2 ON table1.column_name = table2.column_name;
The RIGHT JOIN keyword returns all records from the right table (table2), and the matched records from the left table (table1). The result is NULL from the left side, when there is no match.
      
SELECT column_name(s) FROM table1 RIGHT JOIN table2 ON table1.column_name = table2.column_name;
The FULL OUTER JOIN keyword return all records when there is a match in left (table1) or right (table2) table records.
      
SELECT column_name(s) FROM table1 FULL OUTER JOIN table2 ON table1.column_name = table2.column_name WHERE condition;
A self JOIN is a regular join, but the table is joined with itself.
      
SELECT column_name(s) FROM table1 T1, table1 T2 WHERE condition;
The UNION operator is used to combine the result-set of two or more SELECT statements. Each SELECT statement within UNION must have the same number of columns The columns must also have similar data types The columns in each SELECT statement must also be in the same order
      
SELECT column_name(s) FROM table1 UNION SELECT column_name(s) FROM table2;
The GROUP BY statement group rows that have the same values into summary rows, like "find the number of customers in each country". The GROUP BY statement is often used with aggregate functions (COUNT, MAX, MIN, SUM, AVG) to group the result-set by one or more columns.
      
SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) ORDER BY column_name(s);
The HAVING clause was added to SQL because the WHERE keyword could not be used with aggregate functions.
      
SELECT column_name(s) FROM table_name WHERE condition GROUP BY column_name(s) HAVING condition ORDER BY column_name(s);

Download Project

We are here for you !! ask your project to Implement - Contact US : 96 77 44 38 55

Have a question or need a custom quote?

Contact Us 9677443855